package com.lagou.ModelTest4.First;

public class WorkerTest {
    public static void main(String[] args) {
        //构造Worker类型的引用指向Worker类型对象
        try {
            //1.正常姓名和年龄
            //Worker wr=new Worker("zhangfei",30);
            //System.out.println("获取到的姓名和年龄是:"+wr);

            //2.姓名异常 年龄正常
            //Worker wr=new Worker(null,30);
            //System.out.println("获取到的姓名和年龄是:"+wr);

            //3.姓名正常 年龄异常
            Worker wr=new Worker("zhangfei",160);
            System.out.println("获取到的姓名和年龄是:"+wr);

        } catch (Exception e) {
            e.printStackTrace();
        }finally{
            System.out.println("程序运行结束!");
        }
    }
}
